home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / IntlResources.lisp < prev    next >
Encoding:
Text File  |  1993-09-16  |  12.1 KB  |  314 lines  |  [TEXT/CCL2]

  1.  
  2. (in-package :TRAPS)             ; 
  3. ;     File:        IntlResources.p
  4. ;     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5. ;                 All rights reserved.
  6. ;     Version:    System 7.1 for ETO #11
  7. ;     Created:    Tuesday, March 30, 1993 18:00
  8.  
  9. ; $IFC UNDEFINED UsingIncludes
  10. ; $SETC UsingIncludes := 0
  11. ; $ENDC
  12.  
  13. ; $IFC NOT UsingIncludes
  14.  
  15. ; $ENDC
  16.  
  17. ; $IFC UNDEFINED UsingIntlResources
  18. ; $SETC UsingIntlResources := 1
  19.  
  20. ; $I+
  21. ; $SETC IntlResourcesIncludes := UsingIncludes
  22. ; $SETC UsingIncludes := 1
  23. ; $IFC UNDEFINED UsingTypes
  24.  
  25. (require-interface 'TYPES)      ; $I $$Shell(PInterfaces)Types.p
  26. ; $ENDC
  27. ; $SETC UsingIncludes := IntlResourcesIncludes
  28.  
  29. ;  Bits in the itlcFlags byte.
  30. (defconstant $itlcShowIcon 7)   ; Show icon even if only one script
  31. (defconstant $itlcDualCaret 6)  ; Use dual caret for mixed direction text
  32.  
  33. ;  Bits in the itlcSysFlags word.
  34. (defconstant $itlcSysDirection 15); System direction - left to right/right to left
  35.  
  36. ;  the NumberParts indices 
  37. (defconstant $tokLeftQuote 1)
  38. (defconstant $tokRightQuote 2)
  39. (defconstant $tokLeadPlacer 3)
  40. (defconstant $tokLeader 4)
  41. (defconstant $tokNonLeader 5)
  42. (defconstant $tokZeroLead 6)
  43. (defconstant $tokPercent 7)
  44. (defconstant $tokPlusSign 8)
  45. (defconstant $tokMinusSign 9)
  46. (defconstant $tokThousands 10)
  47. (defconstant $tokSeparator 12)  ; 11 is a reserved field
  48. (defconstant $tokEscape 13)
  49. (defconstant $tokDecPoint 14)
  50. (defconstant $tokEPlus 15)
  51. (defconstant $tokEMinus 16)
  52. (defconstant $tokMaxSymbols 31)
  53.  
  54. (defconstant $curNumberPartsVersion 1); current version of NumberParts record
  55.  
  56. (defconstant $currSymLead 16)
  57. (defconstant $currNegSym 32)
  58. (defconstant $currTrailingZ 64)
  59. (defconstant $currLeadingZ 128)
  60.  
  61. (defconstant $zeroCycle 1)      ; 0:00 AM/PM format
  62. (defconstant $longDay 0)        ; day of the month
  63. (defconstant $longWeek 1)       ; day of the week
  64. (defconstant $longMonth 2)      ; month of the year
  65. (defconstant $longYear 3)       ; year
  66. (defconstant $supDay 1)         ; suppress day of month
  67. (defconstant $supWeek 2)        ; suppress day of week
  68. (defconstant $supMonth 4)       ; suppress month
  69. (defconstant $supYear 8)        ; suppress year
  70. (defconstant $dayLdingZ 32)
  71. (defconstant $mntLdingZ 64)
  72. (defconstant $century 128)
  73. (defconstant $secLeadingZ 32)
  74. (defconstant $minLeadingZ 64)
  75. (defconstant $hrLeadingZ 128)
  76.  
  77. ;  Date Orders 
  78. (defconstant $mdy 0)
  79. (defconstant $dmy 1)
  80. (defconstant $ymd 2)
  81. (defconstant $myd 3)
  82. (defconstant $dym 4)
  83. (defconstant $ydm 5)
  84.  
  85. (defrecord OffPair 
  86.    (offFirst :SIGNED-INTEGER)
  87.    (offSecond :SIGNED-INTEGER)
  88.    )
  89.  
  90. (defrecord OffsetTable (array (ARRAY :OFFPAIR 3)))
  91.  
  92. (def-mactype :INTL0PTR (find-mactype :POINTER))
  93. (def-mactype :INTL0HNDL (find-mactype :HANDLE))
  94. (defrecord (Intl0Rec :handle) 
  95.    (decimalPt :CHARACTER)       ; decimal point character
  96.    (thousSep :CHARACTER)        ; thousands separator character
  97.    (listSep :CHARACTER)         ; list separator character
  98.    (currSym1 :CHARACTER)        ; currency symbol
  99.    (currSym2 :CHARACTER)
  100.    (currSym3 :CHARACTER)
  101.    (currFmt :UNSIGNED-BYTE)     ; currency format flags
  102.    (dateOrder :UNSIGNED-BYTE)   ; order of short date elements: mdy, dmy, etc.
  103.    (shrtDateFmt :UNSIGNED-BYTE) ; format flags for each short date element
  104.    (dateSep :CHARACTER)         ; date separator character
  105.    (timeCycle :UNSIGNED-BYTE)   ; specifies time cycle: 0..23, 1..12, or 0..11
  106.    (timeFmt :UNSIGNED-BYTE)     ; format flags for each time element
  107.    (mornStr :OSTYPE)            ; trailing string for AM if 12-hour cycle
  108.    (eveStr :OSTYPE)             ; trailing string for PM if 12-hour cycle
  109.    (timeSep :CHARACTER)         ; time separator character
  110.    (time1Suff :CHARACTER)       ; trailing string for AM if 24-hour cycle
  111.    (time2Suff :CHARACTER)
  112.    (time3Suff :CHARACTER)
  113.    (time4Suff :CHARACTER)
  114.    (time5Suff :CHARACTER)       ; trailing string for PM if 24-hour cycle
  115.    (time6Suff :CHARACTER)
  116.    (time7Suff :CHARACTER)
  117.    (time8Suff :CHARACTER)
  118.    (metricSys :UNSIGNED-BYTE)   ; 255 if metric, 0 if inches etc.
  119.    (intl0Vers :SIGNED-INTEGER)  ; region code (hi byte) and version (lo byte)
  120.    )
  121.  
  122. (def-mactype :INTL1PTR (find-mactype :POINTER))
  123. (def-mactype :INTL1HNDL (find-mactype :HANDLE))
  124. (defrecord (Intl1Rec :handle) 
  125.    (days (:ARRAY (:STRING 15) 7)); day names
  126.    (months (:ARRAY (:STRING 15) 12)); month names
  127.    (suppressDay :UNSIGNED-BYTE) ; 255 for no day, or flags to suppress any element
  128.    (lngDateFmt :UNSIGNED-BYTE)  ; order of long date elements
  129.    (dayLeading0 :UNSIGNED-BYTE) ; 255 for leading 0 in day number
  130.    (abbrLen :UNSIGNED-BYTE)     ; length for abbreviating names
  131.    (st0 :OSTYPE)                ; separator strings for long date format
  132.    (st1 :OSTYPE)
  133.    (st2 :OSTYPE)
  134.    (st3 :OSTYPE)
  135.    (st4 :OSTYPE)
  136.    (intl1Vers :SIGNED-INTEGER)  ; region code (hi byte) and version (lo byte)
  137.    (localRtn (:ARRAY :SIGNED-INTEGER 1)); now a flag for opt extension
  138.    )
  139.  
  140. (def-mactype :UNTOKENTABLEPTR (find-mactype :POINTER))
  141. (def-mactype :UNTOKENTABLEHANDLE (find-mactype :HANDLE))
  142. (defrecord (UntokenTable :handle) 
  143.    (len :SIGNED-INTEGER)
  144.    (lastToken :SIGNED-INTEGER)
  145.    (index (:ARRAY :SIGNED-INTEGER 256)); index table; last = lastToken
  146.    )
  147.  
  148. (defrecord WideChar 
  149.    (:variant 
  150.  
  151.       ((a (:ARRAY :CHARACTER 2))); 0 is the high order character
  152.  
  153.       ((b :SIGNED-INTEGER))
  154.       ))
  155.  
  156. (defrecord WideCharArr 
  157.    (size :SIGNED-INTEGER)
  158.    (data (:ARRAY :WIDECHAR 10))
  159.    )
  160.  
  161. (def-mactype :NUMBERPARTSPTR (find-mactype :POINTER))
  162. (defrecord NumberParts 
  163.    (version :SIGNED-INTEGER)
  164.    (data (:ARRAY :WIDECHAR 31)) ; index by [tokLeftQuote..tokMaxSymbols]
  165.    (pePlus :WIDECHARARR)
  166.    (peMinus :WIDECHARARR)
  167.    (peMinusPlus :WIDECHARARR)
  168.    (altNumTable :WIDECHARARR)
  169.    (reserved (:ARRAY :CHARACTER 20))
  170.    )
  171.  
  172. (def-mactype :ITL4PTR (find-mactype :POINTER))
  173. (def-mactype :ITL4HANDLE (find-mactype :HANDLE))
  174. (defrecord (Itl4Rec :handle) 
  175.    (flags :SIGNED-INTEGER)      ; reserved
  176.    (resourceType :SIGNED-LONG)  ; contains 'itl4'
  177.    (resourceNum :SIGNED-INTEGER); resource ID
  178.    (version :SIGNED-INTEGER)    ; version number
  179.    (resHeader1 :SIGNED-LONG)    ; reserved
  180.    (resHeader2 :SIGNED-LONG)    ; reserved
  181.    (numTables :SIGNED-INTEGER)  ; number of tables, one-based
  182.    (mapOffset :SIGNED-LONG)     ; offset to table that maps byte to token
  183.    (strOffset :SIGNED-LONG)     ; offset to routine that copies canonical string
  184.    (fetchOffset :SIGNED-LONG)   ; offset to routine that gets next byte of character
  185.    (unTokenOffset :SIGNED-LONG) ; offset to table that maps token to canonical string
  186.    (defPartsOffset :SIGNED-LONG); offset to default number parts table
  187.    (resOffset6 :SIGNED-LONG)    ; reserved
  188.    (resOffset7 :SIGNED-LONG)    ; reserved
  189.    (resOffset8 :SIGNED-LONG)    ; reserved
  190.    )
  191.  
  192. ;  New NItl4Rec for System 7.0: 
  193.  
  194. (def-mactype :NITL4PTR (find-mactype :POINTER))
  195. (def-mactype :NITL4HANDLE (find-mactype :HANDLE))
  196. (defrecord (NItl4Rec :handle) 
  197.    (flags :SIGNED-INTEGER)      ; reserved
  198.    (resourceType :SIGNED-LONG)  ; contains 'itl4'
  199.    (resourceNum :SIGNED-INTEGER); resource ID
  200.    (version :SIGNED-INTEGER)    ; version number
  201.    (format :SIGNED-INTEGER)     ; format code
  202.    (resHeader :SIGNED-INTEGER)  ; reserved
  203.    (resHeader2 :SIGNED-LONG)    ; reserved
  204.    (numTables :SIGNED-INTEGER)  ; number of tables, one-based
  205.    (mapOffset :SIGNED-LONG)     ; offset to table that maps byte to token
  206.    (strOffset :SIGNED-LONG)     ; offset to routine that copies canonical string
  207.    (fetchOffset :SIGNED-LONG)   ; offset to routine that gets next byte of character
  208.    (unTokenOffset :SIGNED-LONG) ; offset to table that maps token to canonical string
  209.    (defPartsOffset :SIGNED-LONG); offset to default number parts table
  210.    (whtSpListOffset :SIGNED-LONG); offset to white space code list
  211.    (resOffset7 :SIGNED-LONG)    ; reserved
  212.    (resOffset8 :SIGNED-LONG)    ; reserved
  213.    (resLength1 :SIGNED-INTEGER) ; reserved
  214.    (resLength2 :SIGNED-INTEGER) ; reserved
  215.    (resLength3 :SIGNED-INTEGER) ; reserved
  216.    (unTokenLength :SIGNED-INTEGER); length of untoken table
  217.    (defPartsLength :SIGNED-INTEGER); length of default number parts table
  218.    (whtSpListLength :SIGNED-INTEGER); length of white space code list
  219.    (resLength7 :SIGNED-INTEGER) ; reserved
  220.    (resLength8 :SIGNED-INTEGER) ; reserved
  221.    )
  222.  
  223. (defrecord TableDirectoryRecord 
  224.    (tableSignature :OSTYPE)     ; 4 byte long table name 
  225.    (reserved :SIGNED-LONG)      ; Reserved for internal use 
  226.    (tableStartOffset :SIGNED-LONG); Table start offset in byte
  227.    (tableSize :SIGNED-LONG)     ; Table size in byte
  228.    )
  229.  
  230. (defrecord Itl5Record 
  231.    (versionNumber :SIGNED-LONG) ; itl5 resource version number 
  232.    (numberOfTables :SIGNED-INTEGER); Number of tables it contains 
  233.    (reserved (:ARRAY :SIGNED-INTEGER 3)); Reserved for internal use 
  234.    (tableDirectory (:ARRAY :TABLEDIRECTORYRECORD 1)); Table directory records 
  235.    )
  236.  
  237. (defrecord RuleBasedTrslRecord 
  238.    (sourceType :SIGNED-INTEGER) ; Transliterate target type for the LHS of the rule 
  239.    (targetType :SIGNED-INTEGER) ; Transliterate target type for the RHS of the rule 
  240.    (formatNumber :SIGNED-INTEGER); Transliterate resource format number 
  241.    (propertyFlag :SIGNED-INTEGER); Transliterate property flags 
  242.    (numberOfRules :SIGNED-INTEGER); Number of rules following this field 
  243.    )
  244.  
  245. (defrecord ItlcRecord 
  246.    (itlcSystem :SIGNED-INTEGER) ; default system script
  247.    (itlcReserved :SIGNED-INTEGER); reserved
  248.    (itlcFontForce :SIGNED-BYTE) ; default font force flag
  249.    (itlcIntlForce :SIGNED-BYTE) ; default intl force flag
  250.    (itlcOldKybd :SIGNED-BYTE)   ; MacPlus intl keybd flag
  251.    (itlcFlags :SIGNED-BYTE)     ; general flags
  252.    (itlcIconOffset :SIGNED-INTEGER); keyboard icon offset; not used in 7.0
  253.    (itlcIconSide :SIGNED-BYTE)  ; keyboard icon side; not used in 7.0
  254.    (itlcIconRsvd :SIGNED-BYTE)  ; rsvd for other icon info
  255.    (itlcRegionCode :SIGNED-INTEGER); preferred verXxx code
  256.    (itlcSysFlags :SIGNED-INTEGER); flags for setting system globals
  257.    (itlcReserved4 (:ARRAY :SIGNED-BYTE 32)); for future use
  258.    )
  259.  
  260. (defrecord ItlbRecord 
  261.    (itlbNumber :SIGNED-INTEGER) ; itl0 id number
  262.    (itlbDate :SIGNED-INTEGER)   ; itl1 id number
  263.    (itlbSort :SIGNED-INTEGER)   ; itl2 id number
  264.    (itlbFlags :SIGNED-INTEGER)  ; Script flags
  265.    (itlbToken :SIGNED-INTEGER)  ; itl4 id number
  266.    (itlbEncoding :SIGNED-INTEGER); itl5 ID # (optional; char encoding)
  267.    (itlbLang :SIGNED-INTEGER)   ; current language for script 
  268.    (itlbNumRep :SIGNED-BYTE)    ; number representation code
  269.    (itlbDateRep :SIGNED-BYTE)   ; date representation code 
  270.    (itlbKeys :SIGNED-INTEGER)   ; KCHR id number
  271.    (itlbIcon :SIGNED-INTEGER)   ; ID # of SICN or kcs#/kcs4/kcs8 suite.
  272.    )
  273.  
  274. ;  New ItlbExtRecord structure for System 7.0 
  275.  
  276. (defrecord ItlbExtRecord 
  277.    (base :ITLBRECORD)           ; un-extended ItlbRecord
  278.    (itlbLocalSize :SIGNED-LONG) ; size of script's local record
  279.    (itlbMonoFond :SIGNED-INTEGER); default monospace FOND ID
  280.    (itlbMonoSize :SIGNED-INTEGER); default monospace font size
  281.    (itlbPrefFond :SIGNED-INTEGER); preferred FOND ID
  282.    (itlbPrefSize :SIGNED-INTEGER); preferred font size
  283.    (itlbSmallFond :SIGNED-INTEGER); default small FOND ID
  284.    (itlbSmallSize :SIGNED-INTEGER); default small font size
  285.    (itlbSysFond :SIGNED-INTEGER); default system FOND ID
  286.    (itlbSysSize :SIGNED-INTEGER); default system font size
  287.    (itlbAppFond :SIGNED-INTEGER); default application FOND ID
  288.    (itlbAppSize :SIGNED-INTEGER); default application font size
  289.    (itlbHelpFond :SIGNED-INTEGER); default Help Mgr FOND ID
  290.    (itlbHelpSize :SIGNED-INTEGER); default Help Mgr font size
  291.    (itlbValidStyles :STYLE)     ; set of valid styles for script
  292.    (itlbAliasStyle :STYLE)      ; style (set) to mark aliases
  293.    )
  294.  
  295. ; $ENDC                         ;  UsingIntlResources 
  296.  
  297. ; $IFC NOT UsingIncludes
  298.  
  299. ; $ENDC
  300.  
  301.  
  302. (export '($YDM $DYM $MYD $YMD $DMY $MDY $HRLEADINGZ $MINLEADINGZ $SECLEADINGZ
  303.           $CENTURY $MNTLDINGZ $DAYLDINGZ $SUPYEAR $SUPMONTH $SUPWEEK $SUPDAY
  304.           $LONGYEAR $LONGMONTH $LONGWEEK $LONGDAY $ZEROCYCLE $CURRLEADINGZ
  305.           $CURRTRAILINGZ $CURRNEGSYM $CURRSYMLEAD $CURNUMBERPARTSVERSION
  306.           $TOKMAXSYMBOLS $TOKEMINUS $TOKEPLUS $TOKDECPOINT $TOKESCAPE
  307.           $TOKSEPARATOR $TOKTHOUSANDS $TOKMINUSSIGN $TOKPLUSSIGN $TOKPERCENT
  308.           $TOKZEROLEAD $TOKNONLEADER $TOKLEADER $TOKLEADPLACER $TOKRIGHTQUOTE
  309.           $TOKLEFTQUOTE $ITLCSYSDIRECTION $ITLCDUALCARET $ITLCSHOWICON))
  310. (provide-interface 'IntlResources)